-
Notifications
You must be signed in to change notification settings - Fork 2.8k
ZEPPELIN-25 Ability to create rich gui inside of Notebook #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I don't think that binding from angular to scala (angularWatch) is really necessary, the binding would be most of the time the other way around, from data to visualization. Also saving the scope values on the Zeppelin context, is having multiple unwanted effects (If I'm right): All of the Zeppelin context is sent back with the angular interpreter result. Considering this also works cross-notebooks, we can imagine the effect of doing a binding of a query result per notebook on all angular interpreter response, also that result would be saved in the notebook. This is a cool demo playing with scope and allowing data sharing between interpreters, but without really working on allowing user to build angular code, it is not doing much more than what could be achieved with a println that would insert its data inside of html tags and add scripts tags for some javascript code. However it's nice to be able to show people what could be possible with the idea of rich gui through angular |
|
@corneadoug Thanks for the feedback. I think binding from angular to scala is also really necessary. For example, want to run analytics routine in scala by clicking button in angular. I expect two way (angular -> scala, scala -> angular) binding is used for most cases. Here's some rule implemented for scope value.
Here's implementation goal of this PR.
So interpreter can interact with GUI, fully. I don't this it is not allowing user to build angular code. Can you be more specific about it? |
|
Binding to scala could be done using a simple service in angularJS. For example: zeppelinInterpreterService.call(interpreterType, functionName, params[]) While having cross-notebooks scope is interesting, rewriting every angular function in scala and saving all scope on the backend seems too complicated, performance risky and heavy. We can write angular code and it will work in some cases, but you will have some problems related to the scope as soon as you start using controller and modules. |
|
I'm not sure why you think you need rewrite every angular function in scala and saving all scope on the backend. You'll write the function only and if only you want to run some code in scala. Scope variable is saved only when it is defined by you. not all scope variable Zeppelin uses. One great thing of AngularJS is, it is watching scope variable's change. I wanted to leverage this advantage. So API is designed to automatically watch scope variable change in scala side. Not js side to manually call some function to notify scope variable change. |
|
I really like the way the display system is growing but I think it is much more interesting if this can be done by separate users. e.g. someone who can code SQL or Scala or Angular and someone who can interact with the data and dive better insights. |
|
@goi |
|
Here's another fun example, that monitors spark worker's cpu and display them on Zeppelin, in realtime. The code is not perfect. but you'll see the idea and capabilities of this Angular display system. Here's scala part import sys.process._
// get cluster cpu info using spark
def getClusterCpu = {
sc.setLocalProperty("spark.scheduler.pool", "fair");
val clusterCpu = sc.parallelize(1 to 10).map{s=>
(("hostname" !!).replace("\n", ""), "mpstat 1 1" !!)
}.map{ s =>
(s._1, ((100.0 - s._2.split("\n")(3).split("\\s+")(10).toDouble)*100).toInt.toDouble / 100)
}.reduceByKey((a,b) => scala.math.max(a,b)).collect.sortWith(_._1 < _._1)
z.angularBind("cpuUsage", clusterCpu)
}
// start monitoring. once a second.
val t = new java.util.Timer()
val task = new java.util.TimerTask {
def run() = getClusterCpu
}
t.schedule(task, 1000L, 1000L)here's angular part %angular
Cluster CPU Usage
<table class="table">
<tr>
<th style="width:200px">Host</th>
<th style="width:100px">Cpu</th>
<th></th>
</tr>
<tr ng-repeat="info in cpuUsage">
<td>{{info._1}}</td>
<td>{{info._2}}</td>
<td>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{info._2}}" aria-valuemin="0" aria-valuemax="100" style="width: {{info._2}}%;">
<span class="sr-only">{{info._2}}%</span>
</div>
</div>
</td>
</tr>
</table> |
|
It's awesome!! |
|
Ready to merge. Documentation will follow. I have made some test and some examples and all works fine. |
|
Please replace the jquery in the controller by angular if you plan on merging Ex: |
|
@corneadoug Thanks for pointing that out. I think replacing jquery to angular is out of this PR's scope. So i think it's better to create a separate issue for that and handle them there. Cool? |
|
There is a lot of them here and there in the code, and these needs to be done in a different PR, Otherwise we would have a PR every 15days to clean it which is not acceptable. |
|
Also there is only 3 of them to change in this PR, in paragraph.js between line 82 and 88 |
|
@corneadoug Changed those 3 |
|
Merging it if there is no more discussions :-) |
|
Hi, I tried running this sample on the latest build but got an error the the On Sun, Apr 12, 2015 at 8:58 AM, asfgit [email protected] wrote:
Eran | CTO |
|
@goi If you restart Zeppelin, it'll be there. |
|
Hi, On Mon, Apr 13, 2015 at 3:49 PM, Lee moon soo [email protected]
Eran | CTO |
|
Have you created interpreter for angular in 'Interpreter' menu? |
|
No, I did not. On Tue, Apr 14, 2015 at 3:33 PM, Lee moon soo [email protected]
Eran | CTO |
|
Yes you should. When Zeppelin starts, if there's no conf/interpreter.json found, Zeppelin creates one with all available interpreters. But you seems you already have conf/interpreter.json created the version without Angular interpreter. So Zeppelin uses existing file and you need manually create it. |
|
Ah, that must be why I couldn't get the new HiveInterpreter working last week. Would it be possible for Zeppelin to add missing interpreter configs to the interpreter.json file rather than only adding them when interpreter.json doesn't exist yet? Otherwise this will always be a problem for users as new interpreters are added. |
|
@ejono |
|
With introduction of interpreterGroup following code from the above example doesn't work anymore. I could track upto different InterpreterContextRunnerPool getting created for multiple interpreters and only one have interpreterContextRunners populated with all my paragraphs. So, sparkInterpreter when sends event to another RemoteInterpreter, it finds the list empty there. z.angularWatch("selectedTable", (before:Object, after:Object) => { It will be great if somebody can fix it asap (because we have a demo pending in another day or two). |
|
@soubhik-c |
|
@soubhik-c |
|
@Leemoonsoo works like a charm... thanks a lot Moon. I've few suggestions/requests that I suppose will make this product better. How can I get started ? |
|
I think mailing list is good place to start sharing suggestions/requests. Creating issue on JIRA works, too. Any suggestions/requests is very much appreciated. so please don't hesitate! |
|
Great demo! I am new with AngularJS. Just wondering how to use it to show network topology (tree-like) in Zeppelin |
|
Looks realy cool but i have an problem maybe one have an quick fix for me |
|
@joku86 You would need to do an |
[Zp-7] Перенос наших локальных изменений на актуальную версию apache/zeppelin


This PR implements https://issues.apache.org/jira/browse/ZEPPELIN-25
Here's a short video demo of this feature.

for someone who want to try, here's api
Any paragraph's output starting with '%angular' will be considered as angular code. %angular as a interpreter also available.

Any feedback is welcome!